package com.yxuan.springboot.mapper;


import com.yxuan.springboot.model.EnrollmentPlan;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 
 * @author zchao
 *    EnrollmentPlanMapper层
 * @date 2023-06-06 13:29:25
 */
@Mapper
public interface EnrollmentPlanMapper extends BaseMapper<EnrollmentPlan> {




    Integer findRequiredNumber(@Param("schoolId") Integer schoolId,@Param("specialityClassification") String SpecialityClassification,@Param("provinceName") String provinceName,@Param("studentYear") String studentYear) throws Exception;

    List<String> findProfessionalNames(@Param("schoolId") Integer schoolId) throws Exception;

    Integer findAllRequireNumbers(@Param("professionalName")String professionalName, @Param("schoolId") Integer schoolId, @Param("province") String province, @Param("classification")String Classification,@Param("year") String targetYear) throws Exception;



    @Select("SELECT student_year FROM `enrollment_plan` \n" +
            "where \n" +
            "\tschool_id = #{school_id}\n" +
            "\tand province_name = #{province_name}\n" +
            "group by student_year")
    List<EnrollmentPlan> getYearByGroup(@Param("school_id") String schoolId, @Param("province_name") String provinceName);

    @Select("select * from enrollment_plan where school_id = #{schoolId} and speciality_classification = #{specialityClassification} and province_name = #{provinceName} and student_year = #{studentYear} and professional_name like concat(#{professionalName},'%') limit 1")
    EnrollmentPlan getEnrollmentPlanInfo(@Param("schoolId") Long schoolId,@Param("specialityClassification") String SpecialityClassification,@Param("provinceName") String provinceName,@Param("studentYear") String studentYear, @Param("professionalName") String professionalName);

    @Select("select * from enrollment_plan where school_id = #{schoolId} and province_name = #{province}")
    List<EnrollmentPlan> getEnrollmentPlanInfoBySchoolIdAndprovince(@Param("schoolId") Integer schoolId, @Param("province") String province);
}
